﻿@using SH = EMoney.IStock.Client.Framework.StringHelper;

@{
    string stocksCode = string.Empty;
    }

<div class="rank_top">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <th width="5%" align="center" valign="middle">@*<a  hidefocus="true" href="javascript:;" class="rank_right_a03"></a>*@序号</th>
            <th width="12%" align="center" valign="middle">时间</th>
            <th width="9%" align="center" valign="middle">名称</th>
            <th width="9%" align="center" valign="middle">代码</th>
            <th width="8%" align="center" valign="middle">交易方向</th>
            <th width="10%" align="center" valign="middle">委托价</th>
            <th width="9%" align="center" valign="middle">委托数</th>
            <th width="9%" align="center" valign="middle">成交价</th>
            <th width="9%" align="center" valign="middle">成交数</th>
            <th width="9%" align="center" valign="middle">状态</th>
            <th width="11%" align="center" valign="middle">操作</th>
        </tr>
    </table>
</div>
<div class="rank_list" style="height:auto;">
    <table width="100%" border="0" cellspacing="0" cellpadding="0" id="tblist">
        @{
            if (ViewBag.UnCancelOrder != null && ViewBag.UnCancelOrder.data != null && ViewBag.UnCancelOrder.data.Count > 0)
            {
                int idx = 1;
                string code = string.Empty;
                string dealprice = string.Empty;
                string dealcount = string.Empty;
                string tradestatus = string.Empty;
               
                foreach (EMoney.IStock.Client.Models.QQ.UnCancelOrderData data in ViewBag.UnCancelOrder.data)
                {
                    code = SH.FormatQQStockCode(data.stock_code);

                    if (stocksCode.IndexOf(code + ",") == -1)
                    {
                        stocksCode += code + ",";
                    }

                    if (data.deal_price == 0)
                    {
                        dealprice = "--";
                    }
                    else
                    {
                        dealprice = SH.FormatDecimal(data.deal_price);
                    }

                    if (data.deal_count == null)
                    {
                        dealcount = "--";
                    }
                    else
                    {
                        dealcount = data.deal_count.Value.ToString();
                    }

                    switch (data.trade_status)
                    {
                        case "request":
                            tradestatus = "已报";
                            break;
                        case "deal":
                            tradestatus = "已成";
                            break;
                        default:
                            tradestatus = "部成";
                            break;
                    }
                    
                    <tr code="@code">
                        <td width="5%" align="center" valign="middle">@idx</td>
                        <td width="12%" align="center" valign="middle">@SH.FormatDateTime(Convert.ToDateTime(data.c_time),"M-d HH:mm:ss")</td>
                        <td width="9%" align="center" valign="middle"><span class="yellow stock">@data.stock_name</span></td>
                        <td width="9%" align="center" valign="middle">@code</td>
                        <td width="8%" align="center" valign="middle"><span class="@SH.FormatTradeDirectionColor(data.trade_direction)">@SH.FormatTradeDirection(data.trade_direction)</span></td>
                        <td width="10%" align="center" valign="middle">@data.trade_price</td>
                        <td width="9%" align="center" valign="middle">@data.trade_count</td>
                        <td width="9%" align="center" valign="middle">@dealprice</td>
                        <td width="9%" align="center" valign="middle">@dealcount</td>
                        <td width="9%" align="center" valign="middle">@tradestatus</td>
                        <td width="11%" align="center" valign="middle"><a  hidefocus="true" href="javascript:;" price="@data.trade_price" count="@data.trade_count" name="@data.stock_name" code="@SH.FormatQQStockCode(data.stock_code)" uuid="@data.order_uuid" class="btn1 cancelorder">撤单</a></td>
                    </tr>
                    idx++;
                }
            }
            else
            {
                <tr>
                    <td colspan="11" style="text-align:center;">--无记录--</td>
                </tr>
            }
        }
    </table>
</div>
<input type="hidden" id="hidStocks" value="@stocksCode" />
<script type="text/javascript">
    klinestocks = $("#hidStocks").val();
</script>